<div id="userlist">
<br/>
<center>
<hr style="color:#e6af2b"/>
<table>
	<tr>
		<th width="300">Exam Name</th>
		<th>Correct</th>
		<th>Items</th>
		<th>Percentage</th>
	</tr>
<?php 	$total_correct = 0;  ?>
<?php 	$total_items = 0;  ?>
<?php 	foreach( $grades as $exam) :  ?>
	<tr style="font-size: 11px; font-family: verdana;">
		<td><?php echo $exam['name'] ?></td>
		<td><?php echo $exam['num_correct'] ? $exam['num_correct'] : '-' ?></td>
		<td><?php echo $exam['items'] ?></td>
		<td><?php printf("%.2f", ($exam['num_correct']/$exam['items'])*100 ) ?></td>
	</tr>
<?php 	$total_correct += $exam['num_correct']  ?>
<?php 	$total_items += $exam['items']  ?>
<?php 	endforeach; ?>
	<tr>
		<td colspan="3"><strong>Average:</strong></td>
		<td><strong><?php count($grades) ? printf("%.2f", ($total_correct/$total_items )*100 ) : 0 ?>%</strong></td>
	</td>
</table>
</center>

</div>
